home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / arcers / tarsrc.zip / TARSRC.TAR / tar-1.11.2 / port.h < prev    next >
C/C++ Source or Header  |  1993-11-15  |  5KB  |  201 lines

  1. /* Portability declarations.  Requires sys/types.h.
  2.    Copyright (C) 1988, 1992 Free Software Foundation
  3.  
  4. This file is part of GNU Tar.
  5.  
  6. GNU Tar is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. GNU Tar is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU Tar; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. /* AIX requires this to be the first thing in the file. */
  21. #ifdef __GNUC__
  22. #define alloca __builtin_alloca
  23. #else /* not __GNUC__ */
  24. #ifdef WINDOWSNT
  25. #include <malloc.h>
  26. #else /* not WINDOWSNT */
  27. #if HAVE_ALLOCA_H
  28. #include <alloca.h>
  29. #else /* not HAVE_ALLOCA_H */
  30. #ifdef _AIX
  31.  #pragma alloca
  32. #else /* not _AIX */
  33. char *alloca ();
  34. #endif /* not _AIX */
  35. #endif /* not HAVE_ALLOCA_H */
  36. #endif /* not WINDOWSNT */
  37. #endif /* not __GNUC__ */
  38.  
  39. #include "pathmax.h"
  40.  
  41. #ifdef _POSIX_VERSION
  42. #include <sys/wait.h>
  43. #else /* !_POSIX_VERSION */
  44. #define WIFSTOPPED(w) (((w) & 0xff) == 0x7f)
  45. #define WIFSIGNALED(w) (((w) & 0xff) != 0x7f && ((w) & 0xff) != 0)
  46. #define WIFEXITED(w) (((w) & 0xff) == 0)
  47.  
  48. #define WSTOPSIG(w) (((w) >> 8) & 0xff)
  49. #define WTERMSIG(w) ((w) & 0x7f)
  50. #define WEXITSTATUS(w) (((w) >> 8) & 0xff)
  51. #endif /* _POSIX_VERSION */
  52.  
  53. /* nonstandard */
  54. #ifndef WIFCOREDUMPED
  55. #define WIFCOREDUMPED(w) (((w) & 0x80) != 0)
  56. #endif
  57.  
  58. #if defined(__MSDOS__) || defined(WINDOWSNT)
  59. /* missing things from sys/stat.h */
  60. #define    S_ISUID        0
  61. #define    S_ISGID        0
  62. #define    S_ISVTX        0
  63.  
  64. /* device stuff */
  65. #define    makedev(ma, mi)        ((ma << 8) | mi)
  66. #define    major(dev)        (dev)
  67. #define    minor(dev)        (dev)
  68. typedef long off_t;
  69. #endif /* __MSDOS__ */
  70.  
  71. #if defined(__STDC__) || defined(__TURBOC__) || defined(WINDOWSNT)
  72. #define PTR void *
  73. #else
  74. #define PTR char *
  75. #define const
  76. #endif
  77.  
  78. /* Since major is a function on SVR4, we can't just use `ifndef major'.  */
  79. #ifdef major            /* Might be defined in sys/types.h.  */
  80. #define HAVE_MAJOR
  81. #endif
  82.  
  83. #if !defined(HAVE_MAJOR) && defined(MAJOR_IN_MKDEV)
  84. #include <sys/mkdev.h>
  85. #define HAVE_MAJOR
  86. #endif
  87.  
  88. #if !defined(HAVE_MAJOR) && defined(MAJOR_IN_SYSMACROS)
  89. #include <sys/sysmacros.h>
  90. #define HAVE_MAJOR
  91. #endif
  92.  
  93. #ifndef HAVE_MAJOR
  94. #define major(dev)  (((dev) >> 8) & 0xff)
  95. #define minor(dev)  ((dev) & 0xff)
  96. #define makedev(maj, min)  (((maj) << 8) | (min))
  97. #endif
  98. #undef HAVE_MAJOR
  99.  
  100. #if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
  101. #include <string.h>
  102. #if !defined(__MSDOS__) && !defined(STDC_HEADERS)
  103. #include <memory.h>
  104. #endif
  105. #ifdef index
  106. #undef index
  107. #endif
  108. #ifdef rindex
  109. #undef rindex
  110. #endif
  111. #define index strchr
  112. #define rindex strrchr
  113. #define bcopy(s, d, n) memcpy(d, s, n)
  114. #define bzero(s, n) memset(s, 0, n)
  115. #define bcmp memcmp
  116. #else
  117. #include <strings.h>
  118. #endif
  119.  
  120. #if defined(STDC_HEADERS)
  121. #include <stdlib.h>
  122. #else
  123. char *malloc (), *realloc ();
  124. char *getenv ();
  125. #endif
  126.  
  127. #ifndef _POSIX_VERSION
  128. #if defined(__MSDOS__) || defined(WINDOWSNT)
  129. #include <io.h>
  130. #else /* !__MSDOS__ */
  131. off_t lseek ();
  132. #endif /* !__MSDOS__ */
  133. #ifdef WINDOWSNT
  134. #include <direct.h>
  135. #else
  136. char *getcwd ();
  137. #endif
  138. #endif /* !_POSIX_VERSION */
  139.  
  140. #ifndef NULL
  141. #define NULL 0
  142. #endif
  143.  
  144. #ifndef    O_BINARY
  145. #define    O_BINARY    0
  146. #endif
  147. #ifndef O_CREAT
  148. #define O_CREAT        0
  149. #endif
  150. #ifndef    O_NDELAY
  151. #define    O_NDELAY    0
  152. #endif
  153. #ifndef    O_RDONLY
  154. #define    O_RDONLY    0
  155. #endif
  156. #ifndef O_RDWR
  157. #define O_RDWR        2
  158. #endif
  159.  
  160. #include <sys/stat.h>
  161. #ifndef S_ISREG            /* Doesn't have POSIX.1 stat stuff. */
  162. #define mode_t unsigned short
  163. #endif
  164. #if !defined(S_ISBLK) && defined(S_IFBLK)
  165. #define    S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
  166. #endif
  167. #if !defined(S_ISCHR) && defined(S_IFCHR)
  168. #define    S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
  169. #endif
  170. #if !defined(S_ISDIR) && defined(S_IFDIR)
  171. #define    S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
  172. #endif
  173. #if !defined(S_ISREG) && defined(S_IFREG)
  174. #define    S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
  175. #endif
  176. #if !defined(S_ISFIFO) && defined(S_IFIFO)
  177. #define    S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
  178. #define mkfifo(path, mode) (mknod ((path), (mode) | S_IFIFO, 0))
  179. #endif
  180. #if !defined(S_ISLNK) && defined(S_IFLNK)
  181. #define    S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
  182. #endif
  183. #if !defined(S_ISSOCK) && defined(S_IFSOCK)
  184. #define    S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
  185. #endif
  186. #if !defined(S_ISMPB) && defined(S_IFMPB)    /* V7 */
  187. #define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
  188. #define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
  189. #endif
  190. #if !defined(S_ISNWK) && defined(S_IFNWK)    /* HP/UX */
  191. #define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
  192. #endif
  193. #if !defined(S_ISCTG) && defined(S_IFCTG)    /* contiguous file */
  194. #define S_ISCTG(m) (((m) & S_IFMT) == S_IFCTG)
  195. #endif
  196. #if !defined(S_ISVTX)
  197. #define S_ISVTX 0001000
  198. #endif
  199.  
  200. #include "sysdir.h"
  201.